import { createRouter, createWebHistory } from 'vue-router'
import index from '@/views/index/index.vue'
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path:'/',
      name:'index',
      component:index,
    },
      //用户首页
    {
      path:'/user/:userid',
      name:'user',
      component:()=> import('@/views/UserView/UserViewIndex.vue'),
      props:true,
    },
    //视频详情页
    {
      path:'/video/:fvid',
      name:'video',
      component:()=> import('@/views/videoPlayView/videoPlayViewIndex.vue'),
      props:true,
    },
      //创作中心
    {
      path: '/platform',
      name: 'platform',
      component: () => import('@/views/PlatForm/PlatFormView.vue'),
      children:[
        {
          path: '',
          redirect:'/platform/home',
        },
        {
          //投稿
          path: 'upload',
          name: 'platform.upload',
          component: () => import('@/views/UploadView/UploadView.vue'),
        },
        {
          //首页
          path: 'home',
          name: 'platform.home',
          component: () => import('@/views/PlatFormHome/PlatFormHomeView.vue'),
        },

        {
          //内容管理->稿件管理
          path: 'upload-manager/article',
          name: 'platform.article',
          component: () => import('@/views/UploadManageView/UploadManageView.vue'),
        },
        {
          //互动管理->评论管理
          path: 'interact/comment',
          name: 'platform.comment',
          component: () => import('@/views/CommentManageView/CommentManageView.vue'),
        },
        {
          //互动管理->弹幕管理
          path: 'interact/danmu',
          name: 'platform.danmu',
          component: () => import('@/views/DanmuManageView/DanmuManageView.vue'),
        },
        {
          //测试页面
          path: 'test/page1',
          name: 'test.page1',
          component: () => import('@/views/TestPages/TestPage1/TestPage1.vue'),
        },
        {
          //测试页面2
          path: 'test/page2',
          name: 'test.page2',
          component: () => import('@/views/TestPages/TestPage1/TestPage2.vue'),
        },

      ]
    },

      //搜素页
    {
      path: '/search',
      name: 'search',
      component: () => import('@/views/SearchView/Search.vue'),
      props: (route) => ({ keyword: route.query.keyword })
    },
      //动态页
    {
      path: '/dynamic',
      name: 'dynamic',
      component: () => import('@/views/DynamicView/DynamicView.vue')
    }

  ],
})

export default router
